package com.java.yz.day07.ketang;

/*
    猫和狗的案例   以下就是重写与继承的小应用
 */
class Animal{
    int age;
    String name;
    public void eat(){
        System.out.println("吃");
    }
}
//继承共同的东西
class Cat extends Animal{
    @Override //方法的重写
    public void eat(){
        System.out.println("猫吃鱼");
    }
}
class Dog extends Animal{
    @Override
    public void eat(){
        System.out.println("狗吃肉");
    }
}
public class ExtendDemo9 {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.eat();
        Dog dog = new Dog();
        dog.eat();
    }
}
